#include "MutaUserCursor.h"
#include <QFont>

MutaUserCursor::MutaUserCursor(QString oID,QString own)
    : MutaObject(oID,Muta::UserCursor,own),
      userNameText(own,this)
{
    setPixmap(QPixmap(":/images/Cursor.png"));
    userNameText.moveBy( 15, 15);
    QFont labelFont("monaco", 10);
    QBrush brush;
    brush.setColor(QColor(255,255,255,255));
    brush.setStyle(Qt::SolidPattern);
    QPen pen;
    pen.setColor(QColor(255,255,255,255));
    userNameText.setPen(pen);
    userNameText.setBrush(brush);
    userNameText.setFont(labelFont);
    userNameText.setFlag( QGraphicsItem::ItemIsSelectable, false );
    userNameText.setFlag( QGraphicsItem::ItemIsMovable, false );
    userNameText.setCacheMode(QGraphicsItem::DeviceCoordinateCache);
    setFlag( QGraphicsItem::ItemIsSelectable, false );
    setFlag( QGraphicsItem::ItemIsMovable, false );
    setZValue(9999999);
}

int MutaUserCursor::type() const
{
    return mutaType;
}

void MutaUserCursor::setPos(const QPointF &pos)
{
    QGraphicsPixmapItem::setPos(Muta::quantizePoint(pos,Muta::BEAT_PIXELS,15)+QPointF(0,7.5));
}

void MutaUserCursor::remoteSetX(float x)
{
    ((QGraphicsPixmapItem*)this)->setX(x);
    //qDebug() << "OSCthulhu set x: " << x;
}

void MutaUserCursor::remoteSetY(float y)
{
    ((QGraphicsPixmapItem*)this)->setY(y);
    //qDebug() << "OSCthulhu set y: " << y;
}
